
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" charset="UTF-8">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta content="telephone=no" name="format-detection" />
<title>信丰县南山寺·善行愿祈</title>

<link rel="stylesheet" href="css/style.css" />

<script src="js/jquery-1.11.1.min.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
<script src="js/vue.min.js"></script>
<script src="js/base.js"></script>

</head>
<body class="xsbody">
<div class="loading fixed" style="display: none;">
  <section>
      <div class="loader loader-20">

      </div>
  </section>
</div>
<div class="main gongdefen" id="app">
  <div class="fixedTitle">
    <div class="con">
      <img src="img/return.png" class="return" @click="window.location.href='./my.html'">
      <p>功德分</p>
    </div>
  </div>
  <div class="touimg">
    <img src="img/2.png" class="fullImg">
    <p>功德分：<span>{{total}}</span></p>
  </div>
  <div class="xslistBox">
    <div class="gdlist">
      <ul>
        <li v-for="i in xslist">
          <div class="tit">
            <p>今日善行祈愿</p>
            <!-- <p>今日众缘赞叹</p> -->
          </div>
          <div>
            <p>
              <span>{{i.createTime}}</span>
            </p>
            <p class="gongde">
              功德<span>+{{i.score}}</span>
            </p>
          </div>
        </li>
      </ul>
    </div>
  </div>

</div>

<script>
  var vm;
  $(function(){
    var vm = new Vue({
      el:"#app",
      data:{
        page:1,
        pagesize:10,
        xslist:[],
        total:'',
        isscroll:true,
        
      },
      
      mounted(){
        let that = this;
        
        that.info();


        $(".gdlist").scroll(function(){
            var scrollTop = $(this).scrollTop();
            var scrollHeight = $(".gdlist ul").height();
            var windowHeight = $(this).height();
            console.log(scrollTop + windowHeight)
            console.log(scrollHeight)
            if ((scrollTop + windowHeight + 10) >= scrollHeight) {
              console.log('加载更多')
              if(that.isscroll){
                
                that.isscroll = false;
                that.page++;
                that.info();
              }
            }
        })

        document.onreadystatechange = function () {
            console.log(document.readyState)
            if (document.readyState == "complete") {
                $(".loading").hide();
                
            }
        }

      },
      
      methods:{
        info(){
          let that = this;
          var url = api+"app/goodMan/myGoodScore/"+userId+"/"+that.page+"/"+that.pagesize;
          jQuery.get(url,function(res){
            if(res.code == 200){
              that.total = res.data.goodScore;
              that.xslist.push(...res.data.list.records)
              that.isscroll = true;
              setTimeout(() => {
                var height = $(window).height() - $(".fixedTitle").outerHeight(true) - $(".touimg").height() + 36
                $(".gdlist").height(height)
              }, 10);
            }
          })
        },
        
        
      }	
      
    })
  })
</script>
</body>
</html>
